<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
        <link href="./resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
        <title>Software Engineering - Group 2</title>
    </h:head>

    <h:body>
        <br></br>
        <div id="top" style="height:100px;">
            <h:graphicImage value="/Images/Office2.png" styleClass="align-Right" />
            <h:graphicImage value="/Images/titlebar.png"/>
            <br></br>
            <div class ="topPaneSubTitle">
                <ui:insert name="top">
                    <!-- Insert additional top information here -->
                </ui:insert>
                
            </div>
            
        </div>
        <div style="width:100%;height: 500px;">
            
            <div id="left" style="width: 15%; height:100%;">
                <span class="sidePaneHeader"> Menu </span>
                <br></br>
                <h:form>    
                    <h:commandLink action="#{userCTRL.cancel}" value="Home"/>
                    <c:choose>
                        <c:when test="#{userCTRL.emptyUser}">
                            <h:panelGrid columns="1" border="0">
                                <h:link outcome="login" value="Login"/>
                                <h:commandLink action="#{userCTRL.registerPrep}" value="Register"/>
                            </h:panelGrid>
                        </c:when>
                        <c:otherwise>
                            <br/>
                            <h:link outcome="ClientAccountDetails" value="My Account"/>
                            <br/>
                            <h:commandLink action="#{itemCTRL.searchPrep}" value="Search"/>
                            <br/>
                            <h:commandLink action="#{itemCTRL.browsePrep}" value="Browse"/>
                            <h:panelGrid columns="1" border="0" rendered="#{userCTRL.user.isAdmin}">
                                <h:commandLink action="#{categoryCTRL.defineNewCategoryPrep}" value="Define New Category"/>
                                <h:commandLink action="#{categoryCTRL.editCategoriesPrep}" value="Edit Categories"/>
                                <h:commandLink action="#{itemCTRL.enterInventoryPrep}" value="Enter Inventory"/>
                                
                                <h:link outcome="Reports" value="View Reports"/>
                                <h:commandLink action="#{userCTRL.manageAccountsPrep}" value="Manage Accounts"/>
                            </h:panelGrid>
                            <h:panelGrid columns="1" border="0" rendered="#{userCTRL.user.isAdmin != true}">
                                
                            </h:panelGrid>
                            <h:commandLink action="#{userCTRL.logout}" value="Log Out"/>
                        </c:otherwise>
                    </c:choose>
                    <br/>
                    <h:link outcome="Feedback" value="Leave Feedback"/>
                </h:form>
                <ui:insert name="left">
                    <!-- Insert additional left information here -->
                </ui:insert>
            </div>
            <div style="width:100%; height:100%;">
                <div id="right" style="width: 20%; height:100%;">
                    <c:if test="#{!userCTRL.emptyUser}">
                        <c:if test="#{!userCTRL.user.isAdmin and facesContext.viewRoot.viewId != '/ManageCart.xhtml' and facesContext.viewRoot.viewId != '/CheckOut.xhtml'}">
                            <span class="sidePaneHeader"> Your Cart </span>
                            <br></br>
                            <c:choose>
                                <c:when test="#{cartCTRL.order.isEmpty}">
                                    You haven't added any items yet
                                </c:when>
                                <c:otherwise>
                                    <h:dataTable value="#{cartCTRL.order.orderLinksList}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px; font-size: 9px;">
                                        <h:column>
                                            <f:facet name="header">
                                                <h:outputText value="Name"/>
                                            </f:facet>
                                            <h:outputText value="#{item.item.name}"/>
                                        </h:column>
                                        <h:column>
                                            <f:facet name="header">
                                                <h:outputText value="Description"/>
                                            </f:facet>
                                            <h:outputText value="#{item.item.descrip}"/>
                                        </h:column>
                                        <h:column>
                                            <f:facet name="header">
                                                <h:outputText value="Quantity"/>
                                            </f:facet>
                                            <h:outputText value="#{item.quantity}"/>
                                        </h:column>
                                        <h:column>
                                            <f:facet name="header">
                                                <h:outputText value="Price"/>
                                            </f:facet>
                                            <h:outputText value="\$#{item.item.price}"/>
                                        </h:column>
                                    </h:dataTable>
                                    <h:outputText value="Total: \$#{cartCTRL.order.amount}"/>
                                    <br/>
                                    <h:link outcome="ManageCart" value="Manage Cart"/>
                                    <br/>
                                    <h:link outcome="CheckOut" value="Checkout"/>
                                </c:otherwise>
                            </c:choose>
                            
                        </c:if>
                        
                    </c:if>                
                    
                </div>
                <div id="content" style="; height:100%; width: 61.5%; overflow: auto; " class="content">
                    <span style="font-size: 10px; color: red;">
                        #{userCTRL.errMsg}
                    </span>
                    <br/>
                    <ui:insert name="body">
                        <!-- Insert content here -->
                    </ui:insert>
                    <br/>
                    <h:form>
                        <h:commandLink rendered="#{facesContext.viewRoot.viewId != '/index.xhtml' and facesContext.viewRoot.viewId != '/AdminHome.xhtml' and facesContext.viewRoot.viewId != '/CustomerMain.xhtml'}" action="#{userCTRL.cancel}" value="Cancel"/>
                    </h:form>
                </div>
            </div>
        </div>
        <div id="bottom" class="bottomPane">
            <center>©2011 Robert Edger, Richard Harris, Jake Sanders, Vince Moore </center>
        </div>
    </h:body>

</html>
